package com.tm.d11_SimpleDateFormat;

import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 202/5/25 Cjj Duration 获取时间间隔的天数、小时数、分钟数、秒数、 纳秒数 
 *  9：05
 */
public class Test3_Duration {
    public static void main(String[] args) {
        LocalDateTime start = LocalDateTime.of(2024, 11, 11, 11, 11, 11);
        LocalDateTime end = LocalDateTime.of(2025, 11, 11, 8, 10, 11);

        //开始时间-结束时间
        Duration duration = Duration.between(start, end);

        System.out.println(duration.toDays());//天数
        System.out.println(duration.toHours());//小时
        System.out.println(duration.toMinutes());//分钟
        System.out.println(duration.toMillis());//秒数
        System.out.println(duration.toNanos());//纳秒


    }
}
